#ifndef UTILS_CXX_INCLUDE_HPP
#define UTILS_CXX_INCLUDE_HPP
/**
 * \file
 * \ingroup utility
 * \brief Include C++ libraries
 */

/**
 * \defgroup utility Utility
 */

#include <algorithm>
#include <atomic>
#include <cctype>
#include <chrono>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <memory>
#include <mutex>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stdexcept>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>

/**
 * \ingroup utility
 * \brief Polyfill of new C++ features
 */
namespace cxx
{
#if defined(__cpp_lib_to_underlying)
    using std::to_underlying;
#else
    /**
     * \brief <utility> (since C++23)
     * \see https://en.cppreference.com/w/cpp/utility/to_underlying
     */
    template <class Enum>
    constexpr std::underlying_type_t<Enum>
    to_underlying(Enum e) noexcept
    {
        return static_cast<std::underlying_type_t<Enum>>(e);
    }
#endif
} // namespace cxx

/**
 * \ingroup utility
 * \brief Polyfill of test-and-branch instruction
 * @{
 */
#define likely(x) __builtin_expect(bool(x), 1)
#define unlikely(x) __builtin_expect(bool(x), 0)
/** @} */

#endif /* UTILS_CXX_INCLUDE_HPP */
